<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">广告回调统计</ui:define>
    <ui:define name="content">
    
    

        <h:form>
            <p:dialog header="操作执行中,请稍候" widgetVar="doing" modal="true" closable="false" resizable="false" draggable="false"/>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix" style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         rendered="#{advertiseTransStatBean.isNormal()}"
                                         actionListener="#{advertiseTransStatBean.getCountSum()}"
                                         update="@form"/>
                        <p:commandButton value="导出" ajax="false" icon="ui-icon-arrowthick-1-s">
					        <p:fileDownload value="#{advertiseTransStatBean.downloadExcel()}" />
					    </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;text-align:center;">
                                <p:outputLabel for="startDate" value="统计时间"/>
                                <p:calendar id="startDate" value="#{advertiseTransStatBean.$.startDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>

                                <p:outputLabel for="channel" value="渠道"/>
                                <p:selectOneMenu id="channel"
                                                 value="#{advertiseTransStatBean.$.channel}"
                                                 filter="true"
                                                 filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="1000" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{advertiseTransStatBean.channelLists}"
                                            var="channelList"
                                            itemLabel="#{channelList.channelCode}" itemValue="#{channelList.channelCode}"/>
                                </p:selectOneMenu>

                                <p:outputLabel value="手机平台"/>
                                <p:selectOneMenu id="billStatus" value="#{advertiseTransStatBean.$.platform}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                  noSelectionOption="true"/>
                                    <f:selectItem itemLabel="android" itemValue="android"/>
                                    <f:selectItem itemLabel="ios" itemValue="ios"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="adsPlatformType" value="广告上报平台"/>
                                <p:selectOneMenu id="adsPlatformType"
                                                 value="#{advertiseTransStatBean.$.adsPlatformType}"
                                                 filter="true"
                                                 filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="1000" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{advertiseListBean.dictionaries[DictionaryCode.ADS_PLATFORM_TYPE]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="statisticRecordDataTable"
                                         style="width: 100%;text-align:center"
                                         var="statisticRecord"
                                         value="#{advertiseTransStatBean.lazyDataModel}"
                                         rows="20"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         reflow="true"
                                         selection="#{advertiseTransStatBean.selectedRecords}"
                                         resizableColumns="true">
                                <p:column headerText="时间">
                                    <h:outputText value="#{statisticRecord.time}"/>
                                </p:column>
                                <p:column headerText="计划标识" style="text-align:center;">
                                    <h:outputText value="#{statisticRecord.adid}"/>
                                </p:column>
                                <p:column headerText="广告平台" style="text-align:center;">
                                    <h:outputText value="#{advertiseTransStatBean.translate(DictionaryCode.ADS_PLATFORM_TYPE,statisticRecord.adsPlatformType)}"/>
                                </p:column>
                                <p:column headerText="手机平台" style="text-align:center;">
                                    <h:outputText value="#{statisticRecord.platform}"/>
                                </p:column>
                                <p:column headerText="渠道号" style="text-align:center;">
                                    <h:outputText value="#{statisticRecord.channel}"/>
                                </p:column>
                                <p:column headerText="回传数:(#{advertiseTransStatBean.sum})" style="text-align:center;">
                                    <h:outputText value="#{statisticRecord.count}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>